#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: tangzhichao

from typing import Dict, Type, List
from . import (
    RecursiveSlicer,
    SemanticSlicer,
    HybridSlicer
)


class SliceStrategySelector:
    """切片策略选择器"""

    _strategies: Dict[str, Type] = {
        "recursive": RecursiveSlicer,  # 原有字符切片
        "semantic": SemanticSlicer,
        "hybrid": HybridSlicer
    }

    @classmethod
    def get_strategy(cls, strategy_name: str, **kwargs):
        """获取切片策略实例"""
        if strategy_name not in cls._strategies:
            raise ValueError(f"Unsupported slicing strategy: {strategy_name}")
        return cls._strategies[strategy_name](**kwargs)

    @classmethod
    def list_strategies(cls) -> List[str]:
        """获取支持的策略列表"""
        return list(cls._strategies.keys())
